<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>个人资料</title>
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/page.css">
    <script src="../js/jquery-3.2.1.min.js"></script>
    <script src="../js/media.js"></script>
    <script src="../js/common.js"></script>
    <style>
        input {
            border: none;
        }
    </style>
</head>

<body>
    <!--头部-->
    <div class="public-header flex" style="background-color: #5F3104;">
        <!--<span class="public-header-left-search"></span>-->
        <span class="public-header-left-back"></span>
        <span class="public-header-center">个人资料</span>
        <span class="public-header-right" style="color: #FFFFFF;font-size: 14px;">保存</span>
    </div>

    <!--正文-->
    <div class="personal-information bc-gray">
        <ul>
            <li class="flex">
                <span>头像</span>
                <em style="background:none;padding-right:0;"><img src="../img/头像 @3x.png" alt="" id="touxiang"></em>
            </li>
            <li class="flex store_name" style="display: none;">
                <span>店铺名字</span>
                <input type="text" placeholder="请填写店铺名字" id="storeName">
            </li>
            <li class="flex">
                <span>签名</span>
                <input type="text" placeholder="请用一句话介绍一下自己吧" id="user_describe">
            </li>
            <li class="flex">
                <span>昵称</span>
                <input type="text" placeholder="请输入昵称" id="user_nick_Name">
            </li>
            <li class="flex">
                <span>微信号</span>
                <input type="text" placeholder="请输入微信号" id="user_weixin">
            </li>
            <li class="flex">
                <span>手机号码</span>
                <input type="text" placeholder="新输入手机号" id="user_Phone">
            </li>
            <li class="flex" onclick="nextAddress()">
                    <span id="address">收货地址</span>
                <em style="" ><span style="padding: 0 5px;"></span></em>
            </li>
        </ul>
   
    </div>

    <script>
        var $html = getQueryString("html");
        if($html == 1){
            $("#address").text("退货地址");
            $(".store_name").show();
        }
        window.onload = function () {
            $.ajax({
                url: base_url + 'ZITAOHUI/user/userInfo',
                data: {
                    uid: sessionStorage.getItem("uid")
                },
                success: function (data){
                    console.log(data)
                    var all_data = data.extend.data;
                    $('#touxiang').attr('src',all_data.user_image)
                    $('#user_describe').val(all_data.user_describe);
                    $('#user_nick_Name').val(all_data.user_nike_Name);
                    $('#user_weixin').val(all_data.user_weixin);
                    $('#user_Phone').val(all_data.user_Phone)
                    $('#storeName').val(all_data.store_name)
                }
            })
            $('.public-header-right').click(function () {
                var user_describe = $('#user_describe').val();
                var user_nick_Name = $('#user_nick_Name').val();
                var user_weixin = $('#user_weixin').val();
                var user_Phone = $('#user_Phone').val();
                var user_storename = $("#storeName").val();
                $.ajax({
                    url: base_url + 'ZITAOHUI/user/compvareInfo',
                    data: {
                        userId: sessionStorage.getItem("uid"),
                        userDescribe: user_describe,
                        userNikeName: user_nick_Name,
                        userWeixin: user_weixin,
                        userPhone: user_Phone,
                        storeName:user_storename
                    },
                    success: function (data) {
                        if(data.code == 1){
                            alert("保存成功");
                        }
                        console.log(data)
                    }
                })
            })
        }
        function nextAddress() {
            window.location.href = "personladdress-list.html";
        }
    </script>



</body>

</html>